/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package redSocial.entities;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author inftel
 */
@Entity
@Table(name = "LISTA")
@NamedQueries({
    @NamedQuery(name = "Lista.findAll", query = "SELECT l FROM Lista l"),
    @NamedQuery(name = "Lista.findByIdLista", query = "SELECT l FROM Lista l WHERE l.idLista = :idLista"),
    @NamedQuery(name = "Lista.findByNombre", query = "SELECT l FROM Lista l WHERE l.nombre = :nombre")})
public class Lista implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID_LISTA")
    private BigDecimal idLista;
    @Column(name = "NOMBRE")
    private String nombre;
    @OneToMany(mappedBy = "lista")
    private Collection<ListaAmigos> listaAmigosCollection;
    @JoinColumn(name = "ID_USUARIO_CREADOR", referencedColumnName = "ID_USUARIO")
    @ManyToOne
    private Usuario usuario;

    public Lista() {
    }

    public Lista(BigDecimal idLista) {
        this.idLista = idLista;
    }

    public BigDecimal getIdLista() {
        return idLista;
    }

    public void setIdLista(BigDecimal idLista) {
        this.idLista = idLista;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public Collection<ListaAmigos> getListaAmigosCollection() {
        return listaAmigosCollection;
    }

    public void setListaAmigosCollection(Collection<ListaAmigos> listaAmigosCollection) {
        this.listaAmigosCollection = listaAmigosCollection;
    }

    public Usuario getUsuario() {
        return usuario;
    }

    public void setUsuario(Usuario usuario) {
        this.usuario = usuario;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idLista != null ? idLista.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Lista)) {
            return false;
        }
        Lista other = (Lista) object;
        if ((this.idLista == null && other.idLista != null) || (this.idLista != null && !this.idLista.equals(other.idLista))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "redSocial.entities.Lista[idLista=" + idLista + "]";
    }

}
